#include "test.h"

#include <locale.h>
#include <stdio.h>
#include <time.h>

static int localeconv_test ()
{
   struct lconv * lc;

   setlocale(LC_MONETARY, "it_IT");
   lc = localeconv();
   printf("Local Currency Symbol: %s\n",lc->currency_symbol);
   printf("International Currency Symbol: %s\n",lc->int_curr_symbol);

   setlocale(LC_MONETARY, "en_US");
   lc = localeconv();
   printf("Local Currency Symbol: %s\n",lc->currency_symbol);
   printf("International Currency Symbol: %s\n",lc->int_curr_symbol);

   setlocale(LC_MONETARY, "en_GB");
   lc = localeconv();
   printf ("Local Currency Symbol: %s\n",lc->currency_symbol);
   printf ("International Currency Symbol: %s\n",lc->int_curr_symbol);

   printf("Decimal Point = %s\n", lc->decimal_point);
   
   return 0;
}

static int setlocale_test()
{
    time_t currtime;
    struct tm *timer;
    char buffer[80];
    
    time( &currtime );
    timer = localtime( &currtime );
    
    printf("Locale is: %s\n", setlocale(LC_ALL, "en_GB.UTF-8"));
    strftime(buffer,80,"%c", timer );
    printf("Date is: %s\n", buffer);
    
    
    printf("Locale is: %s\n", setlocale(LC_ALL, "de_DE.UTF-8"));
    strftime(buffer,80,"%c", timer );
    printf("Date is: %s\n", buffer);
    
    return(0);
}

int locale_test(int argc, char *argv[])
{
    setlocale_test();
    localeconv_test ();
    return 0;
}